package com.a3dweijing.wetouch2.Activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.widget.ImageView;

import com.a3dweijing.wetouch2.R;
import com.a3dweijing.wetouch2.adapter.ThreeDViewpagerAdapter;
import com.a3dweijing.wetouch2.base.BaseActivity;
import com.a3dweijing.wetouch2.fragment.ThreeDBusinessFragment;
import com.a3dweijing.wetouch2.fragment.ThreeDImageFragment;
import com.a3dweijing.wetouch2.fragment.ThreeDSpecialFragment;
import com.a3dweijing.wetouch2.fragment.ThreeDTVFragment;

import java.util.ArrayList;
import java.util.List;

import static com.lzy.okgo.OkGo.getContext;

/**
 * Created by Yxd on 2018/3/26.
 */

public class ThreeDActivity extends BaseActivity {
    private ViewPager mViewPager;
    private TabLayout mTabLeyout;
    private ImageView search;
    private List<String> titles;
    private List<Fragment> fragments;
    private ThreeDTVFragment threeDTVFragment;
    private ThreeDSpecialFragment threeDSpecialFragment;
    private ThreeDImageFragment threeDImageFragment;
    private ThreeDBusinessFragment threeDBusinessFragment;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_3d);
        titles=new ArrayList<>();
        titles.add("影视");
        titles.add("专题");
//        titles.add("原创");
        titles.add("图片");
        titles.add("商务合作");
        fragments=new ArrayList<>();
        fragments.add(threeDTVFragment= ThreeDTVFragment.newinstance());
        fragments.add(threeDSpecialFragment= ThreeDSpecialFragment.newinstance());
//        fragments.add(threeDOriginalFragment = ThreeDOriginalFragment.newinstance());
        fragments.add(threeDImageFragment= ThreeDImageFragment.newinstance());
        fragments.add(threeDBusinessFragment= ThreeDBusinessFragment.newinstance());
        mViewPager= (ViewPager)findViewById(R.id.three_viewpager);
        mTabLeyout= (TabLayout) findViewById(R.id.three_tablayout);
        mViewPager.setAdapter(new ThreeDViewpagerAdapter(getSupportFragmentManager(),getContext(),fragments,titles));
        mTabLeyout.setupWithViewPager(mViewPager);
        mViewPager.setOffscreenPageLimit(2);
    }
}
